package com.ruyuan.engine.drools.process;

import com.ruyuan.engine.drools.Dog;
import com.ruyuan.engine.drools.Users;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

import java.util.Arrays;

public class DroolsDemo2 {
    public static void main(String[] args) {
        KieServices kieServices = KieServices.Factory.get();
        KieContainer kieClasspathContainer = kieServices.getKieClasspathContainer();
        KieSession session1 = kieClasspathContainer.newKieSession("session1");
        Users users = new Users("bob","bigDataEngineer",21, Arrays.asList("swim,game"),new Dog("jark","哈士奇",6));
        session1.insert(users);
        session1.fireAllRules();
        session1.dispose();
        System.out.println(users.getAge());
    }
}
